public class demo33 {
    //位为1的个数（位运算、按位与）
    public static void main(String[] args) {
        class Solution {
            public int hammingWeight(int n) {
                int count = 0;
                while(n!=0)
                {
                    n &= n-1;
                    count++;
                }
                return count;
            }
        }
    }
}
